package com.yami.shop.mystery.common.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yami.shop.common.util.PageParam;
import com.yami.shop.mystery.common.model.MysteryBoxUserArk;
import org.apache.ibatis.annotations.Param;

/**
 * @author wxf
 * @date 2023/4/14 14:27
 */
public interface MysteryBoxUserArkMapper extends BaseMapper<MysteryBoxUserArk> {

    /**
     * 查询用户持有盲盒比已初始化盲盒数量多的列表
     * @param page
     * @param param
     * @return
     */
    IPage<MysteryBoxUserArk> selectNeedInitializePage(@Param("page") PageParam<MysteryBoxUserArk> page, @Param("param") MysteryBoxUserArk param);

    /**
     *  根据盲盒id统计盲盒个数
     *
     * @param boxId
     * @return
     */
    long countByBid(@Param("boxId") Long boxId);

    /**
     *  减开盒次数
     * @param num
     * @param uid
     * @param bid
     * @return
     */
    int updateUidCount(@Param("num") Integer num, @Param("uid") String uid, @Param("bid") Long bid);

    /**
     *   统计该用户该盲盒需要补开盒记录数
     *
     * @param boxId
     * @param uid
     * @return
     */
    Long countInitOpenRecord(@Param("boxId") Long boxId, @Param("uid") String uid);

}
